<?php
function sp_check_auth($permission){
	if(auth()->user()->is_super || auth()->user()->can($permission)){
		return TRUE;
	}
	return FALSE;
}

function sp_get_AddActionButton($currentRouteName){
	$pointPost = strrpos($currentRouteName,'.');
	$parentUrl = substr($currentRouteName,0,$pointPost);
	$thisUrl = $parentUrl.'.'.config('admins.globals.route_rule.create');
	if(sp_check_auth($thisUrl)){
		return '<li>
					<a href="'.route($thisUrl).'" class="btn btn-default">
						<i class="fa fa-plus"></i>添加
					</a>
				</li>';
	}
	return '';
}